home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 3 / CD ACTUAL 3.iso / linux / system / bsvc-1.000 / bsvc-1 / bsvc-1.0.4 / src / Framework / RegInfo.hxx < prev    next >
Encoding:
Text File  |  1995-07-26  |  3.1 KB  |  95 lines

  1. /////////////////////////////////////////////////////////////////////////////// //
  2. // $Id: RegInfo.hxx,v 1.2 1994/09/13 23:22:31 bmott Exp $
  3. /////////////////////////////////////////////////////////////////////////////// //
  4. // RegInfo.hxx
  5. //
  6. //   This class is used by BasicCPU (and derived classes) to manage a list of
  7. // of register structures. 
  8. //
  9. //
  10. // BSVC "A Microprocessor Simulation Framework"
  11. // Copyright (c) 1993
  12. // By: Bradford W. Mott
  13. // October 25,1993
  14. //
  15. ///////////////////////////////////////////////////////////////////////////////
  16. // $Log: RegInfo.hxx,v $
  17. // Revision 1.2  1994/09/13  23:22:31  bmott
  18. // Added public to class declaration of RegisterInformationNode.
  19. //
  20. // Revision 1.1  1994/02/18  19:50:09  bmott
  21. // Initial revision
  22. //
  23. ///////////////////////////////////////////////////////////////////////////////
  24.  
  25. #ifndef REGINFO_HXX
  26. #define REGINFO_HXX
  27.  
  28. #include "BasicCPU.hxx"
  29.  
  30. ///////////////////////////////////////////////////////////////////////////////
  31. // RegisterInformation class declaration
  32. ///////////////////////////////////////////////////////////////////////////////
  33. class RegisterInformation {
  34.   private:
  35.     char *name;         // The name given to the register ("D0","PC",etc)
  36.     char *hex_value;    // The value of the register in hexidecimal
  37.     char *description;  // A short description of the register
  38.  
  39.   public:
  40.     RegisterInformation(const char* name, const char* hex_value,
  41.                         const char* description);
  42.     RegisterInformation();
  43.     ~RegisterInformation();
  44.  
  45.     // Set the name, hex_value, and the description fields
  46.     void Set(const char* name, const char* hex_value, const char* description);
  47.  
  48.     inline const char* Name()
  49.     { return(name); }
  50.  
  51.     inline const char* HexValue()
  52.     { return(hex_value); }
  53.  
  54.     inline const char* Description()
  55.     { return(description); }
  56. };
  57.  
  58.  
  59. ///////////////////////////////////////////////////////////////////////////////
  60. // RegisterInformationList class declaration
  61. ///////////////////////////////////////////////////////////////////////////////
  62. class RegisterInformationList {
  63.   private:
  64.     // Class for a linked list of RegisterInformation structures
  65.     class RegisterInformationNode : public RegisterInformation {
  66.       public:
  67.         RegisterInformationNode* next;
  68.  
  69.         RegisterInformationNode(const char* name, const char* hex_value,
  70.                                 const char* description)
  71.             : RegisterInformation(name,hex_value,description),
  72.               next((RegisterInformationNode*)0)
  73.         { };
  74.     };
  75.  
  76.     RegisterInformationNode* head;  // Head of the linked list
  77.     RegisterInformationNode* tail;  // Tail of the linked list
  78.     int number_of_elements;         // Number of elements in the list
  79.  
  80.   public:
  81.     RegisterInformationList(BasicCPU*);
  82.     ~RegisterInformationList();
  83.  
  84.     // Append an element to the end of the list
  85.     void Append(const char* name,const char* hex_value,const char* description);
  86.  
  87.     // Return the number of elements in the list
  88.     inline int NumberOfElements()
  89.     { return(number_of_elements); }
  90.  
  91.     // Get the element with the given index (return 1=OK,0=ERROR)
  92.     int Element(int,RegisterInformation&);
  93. };
  94. #endif
  95.